<template>
  <div class="header-box">
    <div class="logo">
      <img src="/images/management_logo.png" alt="" />
    </div>
    <div class="btnbox">
      <div>
        <div class="btn" @click="prev">
          <i class="iconfont icon-zuoyou"></i>
        </div>
        <div class="btn" @click="next">
          <i class="iconfont icon-zuoyou1"></i>
        </div>
      </div>
    </div>
    <div class="search-box">
      <el-input
        placeholder="请输入内容"
        v-model="keyword"
        class="input-with-select"
        style="height:40px"
      >
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="goSearch"
        ></el-button>
      </el-input>
    </div>
    <div class="menu">
      <div>
        <div class="btn" @click="onWrite">
          <el-button type="primary" icon="el-icon-edit" circle></el-button>
        </div>
        <div class="btn" @click="exit">
          <el-button type="success" icon="el-icon-s-home" circle></el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      keyword: null,
      path: "",
    }
  },
  watch: {
    // 如果路由发生变化，再次执行该方法
    $route: function(newVal, oldVal) {
      this.path = newVal.path
    },
  },
  methods: {
    prev() {
      this.$router.go(-1)
    },
    next() {
      this.$router.go(1)
    },
    // 退出管理界面（返回首页）
    exit() {
      this.$router.push("/main")
    },
    // 搜索
    goSearch() {
      // this.$router.push("/musichome/search")
      //   this.$router.push({
      //     name: "searchMusic",
      //     query: { keyword: this.keyword },
      //   })
    },
    onWrite() {
      this.$emit("edit")
    },
  },
}
</script>
<style lang="scss" scoped>
@import "./backend.scss";
.header-box {
  height: 60px;
  width: 100%;
  display: flex;
  .logo {
    height: 100%;
    width: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-right: 1px solid rgb(255, 255, 255);
    // border-bottom: 1px solid #ccc;
    box-sizing: border-box;
    background: $backend_background;
    img {
      height: 50px;
      object-fit: cover;
    }
  }
  .btnbox {
    padding-left: 10px;
    width: 100px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    div {
      display: flex;
      .btn {
        height: 30px;
        width: 30px;
        background: white;
        display: flex;
        justify-content: center;
        align-items: center;
        i {
          color: rgb(124, 123, 123);
        }
      }
      .btn:hover {
        cursor: pointer;
      }
      .btn:nth-child(1) {
        border-right: 1px solid #ccc;
      }
    }
  }
  .search-box {
    flex: auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    /deep/ .el-input__inner {
      height: 30px !important;
    }
    /deep/ .el-input {
      height: 30px !important;
      width: 350px !important;
    }
  }
  .menu {
    width: 130px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 10px;
    div {
      display: flex;
      div {
        height: 50px;
        width: 50px;
        display: flex;
        justify-content: center;
        align-items: center;
        i {
          color: white;
          font-size: 19px;
        }
      }
    }
    .btn:hover {
      cursor: pointer;
    }
    .icon-zuixiaohua1 {
      font-size: 19px;
    }
  }
}
.active {
  opacity: 0;
}
</style>
